from django.contrib.auth.models import AbstractUser
from django.db import models


class Clazz(models.Model):
    name = models.CharField(max_length=50, db_comment="班级名")
    manage = models.CharField(max_length=50, db_comment="班主任")
    duration = models.IntegerField(db_comment="课程时长")

    class Meta:
        db_table = 'tb_clazz'


class User(AbstractUser):
    clazz = models.ForeignKey(to=Clazz, on_delete=models.RESTRICT, related_name='users',db_column="clazz_id", null=True,blank=True)

    class Meta:
        swappable = 'AUTH_USER_MODEL'
        db_table = 'auth.user'

